fhand = open('mbox.txt', 'r')

counter = {}
for line in fhand:
    if not line.startswith('From '):
        continue

    words = line.split()
    if len(words) < 1:
        continue

    word = words[1]
    counter[word] = counter.get(word, 0) + 1

print(counter)
